<!doctype html>
<html lang="en" data-color-mode="dark">
<head>
<meta charset="utf-8">
<title>Kubernetes 备忘清单
 &#x26;  kubernetes cheatsheet &#x26;  Quick Reference</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta description="Kubernetes 备忘清单
===

查看资源信息，为开发人员分享快速参考备忘单。">
<meta keywords="kubernetes,reference,Quick,Reference,cheatsheet,cheat,sheet">
<link rel="icon" href="data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20height%3D%221em%22%20width%3D%221em%22%3E%20%3Cpath%20d%3D%22m21.66%2010.44-.98%204.18c-.84%203.61-2.5%205.07-5.62%204.77-.5-.04-1.04-.13-1.62-.27l-1.68-.4c-4.17-.99-5.46-3.05-4.48-7.23l.98-4.19c.2-.85.44-1.59.74-2.2%201.17-2.42%203.16-3.07%206.5-2.28l1.67.39c4.19.98%205.47%203.05%204.49%207.23Z%22%20fill%3D%22%23c9d1d9%22%2F%3E%20%3Cpath%20d%3D%22M15.06%2019.39c-.62.42-1.4.77-2.35%201.08l-1.58.52c-3.97%201.28-6.06.21-7.35-3.76L2.5%2013.28c-1.28-3.97-.22-6.07%203.75-7.35l1.58-.52c.41-.13.8-.24%201.17-.31-.3.61-.54%201.35-.74%202.2l-.98%204.19c-.98%204.18.31%206.24%204.48%207.23l1.68.4c.58.14%201.12.23%201.62.27Zm2.43-8.88c-.06%200-.12-.01-.19-.02l-4.85-1.23a.75.75%200%200%201%20.37-1.45l4.85%201.23a.748.748%200%200%201-.18%201.47Z%22%20fill%3D%22%23228e6c%22%20%2F%3E%20%3Cpath%20d%3D%22M14.56%2013.89c-.06%200-.12-.01-.19-.02l-2.91-.74a.75.75%200%200%201%20.37-1.45l2.91.74c.4.1.64.51.54.91-.08.34-.38.56-.72.56Z%22%20fill%3D%22%23228e6c%22%20%2F%3E%20%3C%2Fsvg%3E" type="image/svg+xml">
<link rel="stylesheet" href="..\style\style.css">
<link rel="stylesheet" href="..\style\katex.css">
</head>
<body><nav class="header-nav"><div class="max-container"><a href="..\index.html" class="logo"><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" height="1em" width="1em">
  <path d="m21.66 10.44-.98 4.18c-.84 3.61-2.5 5.07-5.62 4.77-.5-.04-1.04-.13-1.62-.27l-1.68-.4c-4.17-.99-5.46-3.05-4.48-7.23l.98-4.19c.2-.85.44-1.59.74-2.2 1.17-2.42 3.16-3.07 6.5-2.28l1.67.39c4.19.98 5.47 3.05 4.49 7.23Z" fill="#c9d1d9"></path>
  <path d="M15.06 19.39c-.62.42-1.4.77-2.35 1.08l-1.58.52c-3.97 1.28-6.06.21-7.35-3.76L2.5 13.28c-1.28-3.97-.22-6.07 3.75-7.35l1.58-.52c.41-.13.8-.24 1.17-.31-.3.61-.54 1.35-.74 2.2l-.98 4.19c-.98 4.18.31 6.24 4.48 7.23l1.68.4c.58.14 1.12.23 1.62.27Zm2.43-8.88c-.06 0-.12-.01-.19-.02l-4.85-1.23a.75.75 0 0 1 .37-1.45l4.85 1.23a.748.748 0 0 1-.18 1.47Z" fill="#228e6c"></path>
  <path d="M14.56 13.89c-.06 0-.12-.01-.19-.02l-2.91-.74a.75.75 0 0 1 .37-1.45l2.91.74c.4.1.64.51.54.91-.08.34-.38.56-.72.56Z" fill="#228e6c"></path>
</svg>
<span class="title">Quick Reference</span></a><div class="menu"><a href="javascript:void(0);" class="searchbtn" id="searchbtn"><svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 18 18">
  <path fill="currentColor" d="M17.71,16.29 L14.31,12.9 C15.4069846,11.5024547 16.0022094,9.77665502 16,8 C16,3.581722 12.418278,0 8,0 C3.581722,0 0,3.581722 0,8 C0,12.418278 3.581722,16 8,16 C9.77665502,16.0022094 11.5024547,15.4069846 12.9,14.31 L16.29,17.71 C16.4777666,17.8993127 16.7333625,18.0057983 17,18.0057983 C17.2666375,18.0057983 17.5222334,17.8993127 17.71,17.71 C17.8993127,17.5222334 18.0057983,17.2666375 18.0057983,17 C18.0057983,16.7333625 17.8993127,16.4777666 17.71,16.29 Z M2,8 C2,4.6862915 4.6862915,2 8,2 C11.3137085,2 14,4.6862915 14,8 C14,11.3137085 11.3137085,14 8,14 C4.6862915,14 2,11.3137085 2,8 Z"></path>
</svg><span>搜索</span><span>⌘K</span></a><a href="https://github.com/jaywcjlove/reference/blob/main/docs/kubernetes.md" class="" target="__blank"><svg viewBox="0 0 36 36" fill="currentColor" height="1em" width="1em"><path d="m33 6.4-3.7-3.7a1.71 1.71 0 0 0-2.36 0L23.65 6H6a2 2 0 0 0-2 2v22a2 2 0 0 0 2 2h22a2 2 0 0 0 2-2V11.76l3-3a1.67 1.67 0 0 0 0-2.36ZM18.83 20.13l-4.19.93 1-4.15 9.55-9.57 3.23 3.23ZM29.5 9.43 26.27 6.2l1.85-1.85 3.23 3.23Z"></path><path fill="none" d="M0 0h36v36H0z"></path></svg><span>编辑</span></a><button id="darkMode" type="button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="light" height="1em" width="1em">
  <path d="M6.995 12c0 2.761 2.246 5.007 5.007 5.007s5.007-2.246 5.007-5.007-2.246-5.007-5.007-5.007S6.995 9.239 6.995 12zM11 19h2v3h-2zm0-17h2v3h-2zm-9 9h3v2H2zm17 0h3v2h-3zM5.637 19.778l-1.414-1.414 2.121-2.121 1.414 1.414zM16.242 6.344l2.122-2.122 1.414 1.414-2.122 2.122zM6.344 7.759 4.223 5.637l1.415-1.414 2.12 2.122zm13.434 10.605-1.414 1.414-2.122-2.122 1.414-1.414z"></path>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24" class="dark" height="1em" width="1em">
  <path d="M12 11.807A9.002 9.002 0 0 1 10.049 2a9.942 9.942 0 0 0-5.12 2.735c-3.905 3.905-3.905 10.237 0 14.142 3.906 3.906 10.237 3.905 14.143 0a9.946 9.946 0 0 0 2.735-5.119A9.003 9.003 0 0 1 12 11.807z"></path>
</svg>
</button><script src="../js/dark.js?v=1.4.1"></script><a href="https://github.com/jaywcjlove/reference" class="" target="__blank"><svg viewBox="0 0 16 16" fill="currentColor" height="1em" width="1em"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg></a></div></div></nav><div class="wrap h1body-exist max-container"><header class="wrap-header h1wrap"><h1 id="kubernetes-备忘清单"><svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24" height="1em" width="1em">
  <path d="m10.013 13.738-2.254.387a4.475 4.475 0 0 0 1.753 2.231l.865-2.095a.27.27 0 0 0 .022-.228c-.022-.18-.204-.295-.386-.295zm.865-2.914c.205 0 .387-.159.387-.364l.114-2.277-.456.091a4.516 4.516 0 0 0-2.118 1.162l1.89 1.343c.069.022.115.045.183.045zm-1.002 1.48a.366.366 0 0 0-.045-.524l-1.685-1.503a4.797 4.797 0 0 0-.661 2.778l2.209-.637c.091-.023.137-.046.182-.114zm1.457.797.616.296.614-.296.16-.661-.433-.546h-.683l-.433.546zm1.344-2.436c.114.159.341.182.5.091l1.867-1.32a4.286 4.286 0 0 0-2.573-1.23l.137 2.3a.215.215 0 0 0 .069.159z"></path>
  <path d="m21.944 14.103-1.73-7.446c-.113-.364-.387-.66-.729-.842L12.541 2.49c-.182-.091-.387-.114-.569-.114s-.387 0-.569.045L4.457 5.769a1.22 1.22 0 0 0-.683.842l-1.708 7.492c-.068.387.023.774.25 1.093l4.805 5.943c.273.273.66.456 1.047.479h7.651c.41.045.797-.137 1.048-.479l4.805-5.943c.227-.319.318-.706.272-1.093zm-2.845.501c-.046 0-.068 0-.114-.023-.022-.023-.022-.023-.045-.023-.046 0-.068-.022-.092-.022-.091-.023-.159-.068-.25-.114a.32.32 0 0 1-.137-.045h-.022a3.91 3.91 0 0 0-.729-.205h-.022a.26.26 0 0 0-.182.068s0 .023-.023.023l-.183-.024a5.628 5.628 0 0 1-2.46 3.097l.068.182s-.022 0-.022.022a.264.264 0 0 0-.022.228c.091.228.205.455.364.66v.045a.396.396 0 0 1 .091.114.81.81 0 0 1 .159.228c.023.022.046.045.046.068 0 0 .022 0 .022.022a.582.582 0 0 1 .023.342.38.38 0 0 1-.205.25c-.068.022-.114.045-.183.045a.511.511 0 0 1-.433-.273c-.022 0-.022-.022-.022-.022-.022-.023-.022-.045-.046-.068-.045-.068-.068-.159-.091-.25l-.046-.137v-.022a3.816 3.816 0 0 0-.296-.706.353.353 0 0 0-.182-.137c0-.023 0-.023-.023-.023l-.091-.159c-.228.068-.479.159-.729.205-.41.114-.82.159-1.229.159a5.368 5.368 0 0 1-1.981-.364l-.091.182c0 .023 0 .023-.023.023a.35.35 0 0 0-.182.137c-.114.228-.228.455-.296.706l-.045.137c-.023.091-.068.159-.091.25-.022.023-.045.045-.045.068-.023 0-.023.022-.023.022a.508.508 0 0 1-.433.273.434.434 0 0 1-.159-.045.469.469 0 0 1-.182-.615c.023 0 .023-.023.023-.023.022-.023.022-.045.045-.068.068-.091.114-.182.159-.228s.068-.068.091-.114v-.023a3.73 3.73 0 0 0 .364-.66.268.268 0 0 0-.023-.228s-.022 0-.022-.022l.114-.16a3.578 3.578 0 0 1-.615-.41 5.493 5.493 0 0 1-1.867-2.664l-.205.022s0-.022-.023-.022a.256.256 0 0 0-.182-.068h-.022a4.015 4.015 0 0 0-.751.205h-.024c-.045 0-.091.023-.137.046-.068.022-.159.068-.25.091-.022 0-.091-.022-.091 0 0 .023 0 .023-.023.023-.045.023-.068.023-.114.023a.424.424 0 0 1-.456-.319.445.445 0 0 1 .364-.524c.023-.023.023-.023.046-.023.045 0 .068-.022.091-.022.091 0 .182-.023.273-.023.045-.022.091-.022.137-.022a4.2 4.2 0 0 0 .774-.137c.068-.046.137-.091.16-.16 0 0 .022 0 .022-.022l.182-.046c-.205-1.298.091-2.618.797-3.734.022-.045.045-.068.068-.114l-.131-.132a.106.106 0 0 1-.004.019v-.023l.004.004c.01-.065-.031-.145-.072-.186-.182-.182-.41-.319-.638-.455l-.136-.069a2.587 2.587 0 0 1-.251-.136c-.022 0-.068-.045-.068-.045s0-.023-.022-.023a.49.49 0 0 1-.092-.639c.068-.114.182-.159.319-.159a.54.54 0 0 1 .319.114l.023.023c.022.022.045.022.068.045.068.069.114.137.182.205.023.022.068.045.091.091.159.182.364.364.569.524.045.022.091.045.137.045.045 0 .068-.023.091-.023h.023l.137.091a5.426 5.426 0 0 1 2.801-1.594c.273-.046.523-.091.774-.114l.023-.182v-.045c.068-.045.091-.114.114-.182 0-.273 0-.524-.045-.774v-.023c0-.045 0-.091-.023-.137a1.129 1.129 0 0 1-.045-.273v-.113c0-.114.045-.228.137-.319.114-.114.25-.182.387-.159a.45.45 0 0 1 .387.478v.137c-.023.091-.023.182-.045.273 0 .045-.023.091-.023.136v.023c-.048.273-.048.524-.048.774.023.068.045.136.114.182v-.023l.023.182a5.84 5.84 0 0 1 2.96 1.184c.183.182.387.364.569.546l.183-.114h.022c.022.023.068.023.091.023.046 0 .091-.023.137-.045.205-.137.41-.319.569-.501.022-.023.068-.046.091-.091.046-.068.114-.137.183-.205.022 0 .045-.022.068-.045l.022-.023a.546.546 0 0 1 .318-.114c.114 0 .251.068.319.16.159.205.113.478-.091.637 0 .023.022.023 0 .046-.023.022-.046.022-.068.045-.092.045-.16.091-.251.137l-.137.068a4.104 4.104 0 0 0-.638.455c-.045.046-.068.137-.068.205v.023l-.136.137c.364.569.638 1.207.797 1.867.137.66.182 1.343.091 2.003l.182.046a.278.278 0 0 0 .16.159c.25.068.523.114.773.137h.023a.297.297 0 0 0 .137.022c.091 0 .182 0 .272.023.046 0 .092 0 .092.023 0 .022.022.022.045.022a.537.537 0 0 1 .41.479.49.49 0 0 1-.453.32z"></path>
  <path d="M12.085 14.718a.352.352 0 0 0-.455.091l-1.116 2.027c.456.136.957.228 1.435.228.341 0 .66-.045.979-.114.159-.045.296-.068.433-.091l-1.093-1.981c-.069-.069-.115-.115-.183-.16zm3.644-4.441-1.708 1.548a.36.36 0 0 0-.091.16c-.046.205.068.41.273.455l2.163.615a4.375 4.375 0 0 0-.092-1.435 4.63 4.63 0 0 0-.545-1.343zm-2.073 3.484a.371.371 0 0 0-.205.433l.889 2.141a4.366 4.366 0 0 0 1.366-1.366c.182-.25.318-.547.433-.865l-2.277-.387a.634.634 0 0 0-.206.044z"></path>
</svg>
<a aria-hidden="true" tabindex="-1" href="#kubernetes-备忘清单"><span class="icon icon-link"></span></a>Kubernetes 备忘清单</h1><div class="wrap-body">
</div></header><div class="menu-tocs"><div class="menu-btn"><svg aria-hidden="true" fill="currentColor" height="1em" width="1em" viewBox="0 0 16 16" version="1.1" data-view-component="true">
  <path fill-rule="evenodd" d="M2 4a1 1 0 100-2 1 1 0 000 2zm3.75-1.5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zM3 8a1 1 0 11-2 0 1 1 0 012 0zm-1 6a1 1 0 100-2 1 1 0 000 2z"></path>
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#查看资源信息">查看资源信息</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#节点">节点</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#容器组">容器组</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#命名空间">命名空间</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#无状态">无状态</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#服务">服务</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#守护进程集">守护进程集</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#事件">事件</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#日志">日志</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#服务帐户">服务帐户</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#副本集">副本集</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#角色">角色</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#保密字典">保密字典</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#配置项">配置项</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#路由">路由</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#持久卷">持久卷</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#持久卷声明">持久卷声明</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#存储类">存储类</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#多个资源">多个资源</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#变更资源属性">变更资源属性</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#污点">污点</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#标签">标签</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#维护可调度">维护/可调度</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#清空节点">清空节点</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#节点容器组">节点/容器组</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#无状态命名空间">无状态/命名空间</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#服务-1">服务</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#守护进程集-1">守护进程集</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#服务账号">服务账号</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#注释">注释</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#添加资源">添加资源</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#创建容器组">创建容器组</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#创建服务">创建服务</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#创建无状态应用">创建无状态应用</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#容器交互">容器交互</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#输出yaml文件">输出YAML文件</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#获取帮助">获取帮助</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#请求">请求</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#api调用">API调用</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#集群信息">集群信息</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#另见">另见</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="查看资源信息"><a aria-hidden="true" tabindex="-1" href="#查看资源信息"><span class="icon icon-link"></span></a>查看资源信息</h2><div class="wrap-body">
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="节点"><a aria-hidden="true" tabindex="-1" href="#节点"><span class="icon icon-link"></span></a>节点</h3><div class="wrap-body">
<p>资源名称: nodes, 缩写: no</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get no          <span class="token comment"># 显示所有节点信息</span>
</span><span class="code-line">$ kubectl get no <span class="token parameter variable">-o</span> wide  <span class="token comment"># 显示所有节点的更多信息</span>
</span><span class="code-line">$ kubectl describe no     <span class="token comment"># 显示节点详情</span>
</span><span class="code-line">$ kubectl get no <span class="token parameter variable">-o</span> yaml  <span class="token comment"># 以yaml格式，显示节点详情</span>
</span><span class="code-line">$ kubectl get <span class="token function">node</span> <span class="token parameter variable">--selector</span><span class="token operator">=</span><span class="token punctuation">[</span>label_name<span class="token punctuation">]</span> <span class="token comment"># 筛选指定标签的节点</span>
</span><span class="code-line">$ kubectl get nodes <span class="token parameter variable">-o</span> <span class="token assign-left variable">jsonpath</span><span class="token operator">=</span><span class="token string">'{.items[*].status.addresses[?(@.type=="ExternalIP")].address}'</span>
</span><span class="code-line"><span class="token comment"># 输出jsonpath表达式定义的字段信息</span>
</span><span class="code-line">$ kubectl <span class="token function">top</span> <span class="token function">node</span> <span class="token punctuation">[</span>node_name<span class="token punctuation">]</span> <span class="token comment"># 显示节点(CPU/内存/存储)使用情况</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="容器组"><a aria-hidden="true" tabindex="-1" href="#容器组"><span class="icon icon-link"></span></a>容器组</h3><div class="wrap-body">
<p>资源名称: pods, 缩写: po</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get po         <span class="token comment"># 显示所有容器组信息</span>
</span><span class="code-line">$ kubectl get po <span class="token parameter variable">-o</span> wide
</span><span class="code-line">$ kubectl describe po
</span><span class="code-line">$ kubectl get po --show-labels   <span class="token comment"># 查看容器组的labels</span>
</span><span class="code-line">$ kubectl get po <span class="token parameter variable">-l</span> <span class="token assign-left variable">app</span><span class="token operator">=</span>nginx
</span><span class="code-line">$ kubectl get po <span class="token parameter variable">-o</span> yaml
</span><span class="code-line">$ kubectl get pod <span class="token punctuation">[</span>pod_name<span class="token punctuation">]</span> <span class="token parameter variable">-o</span> yaml <span class="token parameter variable">--export</span>
</span><span class="code-line">$ kubectl get pod <span class="token punctuation">[</span>pod_name<span class="token punctuation">]</span> <span class="token parameter variable">-o</span> yaml <span class="token parameter variable">--export</span> <span class="token operator">></span> nameoffile.yaml 
</span><span class="code-line"><span class="token comment"># 以yaml格式导出容器组信息到yaml文件</span>
</span><span class="code-line">$ kubectl get pods --field-selector <span class="token assign-left variable">status.phase</span><span class="token operator">=</span>Running     
</span><span class="code-line"><span class="token comment"># 使用字段选择器筛选出容器组信息</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="命名空间"><a aria-hidden="true" tabindex="-1" href="#命名空间"><span class="icon icon-link"></span></a>命名空间</h3><div class="wrap-body">
<p>资源名称: namespaces, 缩写: ns</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get ns
</span><span class="code-line">$ kubectl get ns <span class="token parameter variable">-o</span> yaml
</span><span class="code-line">$ kubectl describe ns
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="无状态"><a aria-hidden="true" tabindex="-1" href="#无状态"><span class="icon icon-link"></span></a>无状态</h3><div class="wrap-body">
<p>资源名称: deployments, 缩写: deploy</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get deploy
</span><span class="code-line">$ kubectl describe deploy
</span><span class="code-line">$ kubectl get deploy <span class="token parameter variable">-o</span> wide 
</span><span class="code-line">$ kubectl get deploy <span class="token parameter variable">-o</span> yaml
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="服务"><a aria-hidden="true" tabindex="-1" href="#服务"><span class="icon icon-link"></span></a>服务</h3><div class="wrap-body">
<p>资源名称: services, 缩写: svc</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get svc
</span><span class="code-line">$ kubectl describe svc
</span><span class="code-line">$ kubectl get svc <span class="token parameter variable">-o</span> wide 
</span><span class="code-line">$ kubectl get svc <span class="token parameter variable">-o</span> yaml
</span><span class="code-line">$ kubectl get svc --show-labels
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="守护进程集"><a aria-hidden="true" tabindex="-1" href="#守护进程集"><span class="icon icon-link"></span></a>守护进程集</h3><div class="wrap-body">
<p>资源名称: daemonsets, 缩写: ds</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get ds
</span><span class="code-line">$ kubectl describe ds --all-namespaces
</span><span class="code-line">$ kubectl describe ds <span class="token punctuation">[</span>daemonset_name<span class="token punctuation">]</span> <span class="token parameter variable">-n</span> <span class="token punctuation">[</span>namespace_name<span class="token punctuation">]</span>
</span><span class="code-line">$ kubectl get ds <span class="token punctuation">[</span>ds_name<span class="token punctuation">]</span> <span class="token parameter variable">-n</span> <span class="token punctuation">[</span>ns_name<span class="token punctuation">]</span> <span class="token parameter variable">-o</span> yaml
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="事件"><a aria-hidden="true" tabindex="-1" href="#事件"><span class="icon icon-link"></span></a>事件</h3><div class="wrap-body">
<p>资源名称: events, 缩写: ev</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get events 
</span><span class="code-line">$ kubectl get events <span class="token parameter variable">-n</span> kube-system
</span><span class="code-line">$ kubectl get events <span class="token parameter variable">-w</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="日志"><a aria-hidden="true" tabindex="-1" href="#日志"><span class="icon icon-link"></span></a>日志</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl logs <span class="token punctuation">[</span>pod_name<span class="token punctuation">]</span>
</span><span class="code-line">$ kubectl logs <span class="token parameter variable">--since</span><span class="token operator">=</span>1h <span class="token punctuation">[</span>pod_name<span class="token punctuation">]</span>
</span><span class="code-line">$ kubectl logs <span class="token parameter variable">--tail</span><span class="token operator">=</span><span class="token number">20</span> <span class="token punctuation">[</span>pod_name<span class="token punctuation">]</span>
</span><span class="code-line">$ kubectl logs <span class="token parameter variable">-f</span> <span class="token parameter variable">-c</span> <span class="token punctuation">[</span>container_name<span class="token punctuation">]</span> <span class="token punctuation">[</span>pod_name<span class="token punctuation">]</span>
</span><span class="code-line">$ kubectl logs <span class="token punctuation">[</span>pod_name<span class="token punctuation">]</span> <span class="token operator">></span> pod.log
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="服务帐户"><a aria-hidden="true" tabindex="-1" href="#服务帐户"><span class="icon icon-link"></span></a>服务帐户</h3><div class="wrap-body">
<p>资源名称: serviceaccounts, 缩写: sa</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get sa
</span><span class="code-line">$ kubectl get sa <span class="token parameter variable">-o</span> yaml
</span><span class="code-line">$ kubectl get serviceaccounts default <span class="token parameter variable">-o</span> yaml <span class="token operator">></span>./sa.yaml
</span><span class="code-line">$ kubectl replace serviceaccount default <span class="token parameter variable">-f</span> ./sa.yaml
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="副本集"><a aria-hidden="true" tabindex="-1" href="#副本集"><span class="icon icon-link"></span></a>副本集</h3><div class="wrap-body">
<p>资源名称: replicasets, 缩写: rs</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get rs
</span><span class="code-line">$ kubectl describe rs
</span><span class="code-line">$ kubectl get rs <span class="token parameter variable">-o</span> wide 
</span><span class="code-line">$ kubectl get rs <span class="token parameter variable">-o</span> yaml
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="角色"><a aria-hidden="true" tabindex="-1" href="#角色"><span class="icon icon-link"></span></a>角色</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get roles --all-namespaces
</span><span class="code-line">$ kubectl get roles --all-namespaces <span class="token parameter variable">-o</span> yaml
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="保密字典"><a aria-hidden="true" tabindex="-1" href="#保密字典"><span class="icon icon-link"></span></a>保密字典</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get secrets
</span><span class="code-line">$ kubectl get secrets --all-namespaces 
</span><span class="code-line">$ kubectl get secrets <span class="token parameter variable">-o</span> yaml
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="配置项"><a aria-hidden="true" tabindex="-1" href="#配置项"><span class="icon icon-link"></span></a>配置项</h3><div class="wrap-body">
<p>资源名称: configmaps, 缩写: cm</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get cm
</span><span class="code-line">$ kubectl get cm --all-namespaces
</span><span class="code-line">$ kubectl get cm --all-namespaces <span class="token parameter variable">-o</span> yaml
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="路由"><a aria-hidden="true" tabindex="-1" href="#路由"><span class="icon icon-link"></span></a>路由</h3><div class="wrap-body">
<p>资源名称: ingresses, 缩写: ing</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get ing
</span><span class="code-line">$ kubectl get ing --all-namespaces
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="持久卷"><a aria-hidden="true" tabindex="-1" href="#持久卷"><span class="icon icon-link"></span></a>持久卷</h3><div class="wrap-body">
<p>资源名称: persistentvolumes, 缩写: pv</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get <span class="token function">pv</span> 
</span><span class="code-line">$ kubectl describe <span class="token function">pv</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="持久卷声明"><a aria-hidden="true" tabindex="-1" href="#持久卷声明"><span class="icon icon-link"></span></a>持久卷声明</h3><div class="wrap-body">
<p>资源名称: persistentvolumeclaims, 缩写: pvc</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get pvc
</span><span class="code-line">$ kubectl describe pvc
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="存储类"><a aria-hidden="true" tabindex="-1" href="#存储类"><span class="icon icon-link"></span></a>存储类</h3><div class="wrap-body">
<p>资源名称: storageclasses, 缩写: sc</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get sc
</span><span class="code-line">$ kubectl get sc <span class="token parameter variable">-o</span> yaml
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="多个资源"><a aria-hidden="true" tabindex="-1" href="#多个资源"><span class="icon icon-link"></span></a>多个资源</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get svc, po
</span><span class="code-line">$ kubectl get deploy, no
</span><span class="code-line">$ kubectl get all
</span><span class="code-line">$ kubectl get all --all-namespaces
</span></code></pre>
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="变更资源属性"><a aria-hidden="true" tabindex="-1" href="#变更资源属性"><span class="icon icon-link"></span></a>变更资源属性</h2><div class="wrap-body">
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="污点"><a aria-hidden="true" tabindex="-1" href="#污点"><span class="icon icon-link"></span></a>污点</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl taint <span class="token punctuation">[</span>node_name<span class="token punctuation">]</span> <span class="token punctuation">[</span>taint_name<span class="token punctuation">]</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="标签"><a aria-hidden="true" tabindex="-1" href="#标签"><span class="icon icon-link"></span></a>标签</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl label nodes <span class="token operator">&#x3C;</span>node-name<span class="token operator">></span> <span class="token operator">&#x3C;</span>label-key<span class="token operator">>=</span><span class="token operator">&#x3C;</span>label-value<span class="token operator">></span>  <span class="token comment">#增加</span>
</span><span class="code-line">$ kubectl label nodes <span class="token operator">&#x3C;</span>node-name<span class="token operator">></span> <span class="token operator">&#x3C;</span>label-key<span class="token operator">></span>- <span class="token comment">#删除</span>
</span><span class="code-line">$ kubectl label nodes <span class="token operator">&#x3C;</span>node-name<span class="token operator">></span> <span class="token operator">&#x3C;</span>label-key<span class="token operator">>=</span><span class="token operator">&#x3C;</span>label-value<span class="token operator">></span> <span class="token parameter variable">--overwrite</span> <span class="token comment">#修改</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="维护可调度"><a aria-hidden="true" tabindex="-1" href="#维护可调度"><span class="icon icon-link"></span></a>维护/可调度</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl cordon <span class="token punctuation">[</span>node_name<span class="token punctuation">]</span>   <span class="token comment"># 节点维护</span>
</span><span class="code-line">$ kubectl uncordon <span class="token punctuation">[</span>node_name<span class="token punctuation">]</span> <span class="token comment"># 节点可调度</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="清空节点"><a aria-hidden="true" tabindex="-1" href="#清空节点"><span class="icon icon-link"></span></a>清空节点</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl drain <span class="token punctuation">[</span>node_name<span class="token punctuation">]</span>    <span class="token comment"># 清空节点</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="节点容器组"><a aria-hidden="true" tabindex="-1" href="#节点容器组"><span class="icon icon-link"></span></a>节点/容器组</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl delete <span class="token function">node</span> <span class="token punctuation">[</span>node_name<span class="token punctuation">]</span> 
</span><span class="code-line">$ kubectl delete pod <span class="token punctuation">[</span>pod_name<span class="token punctuation">]</span>
</span><span class="code-line">$ kubectl edit <span class="token function">node</span> <span class="token punctuation">[</span>node_name<span class="token punctuation">]</span>
</span><span class="code-line">$ kubectl edit pod <span class="token punctuation">[</span>pod_name<span class="token punctuation">]</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="无状态命名空间"><a aria-hidden="true" tabindex="-1" href="#无状态命名空间"><span class="icon icon-link"></span></a>无状态/命名空间</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl edit deploy <span class="token punctuation">[</span>deploy_name<span class="token punctuation">]</span>
</span><span class="code-line">$ kubectl delete deploy <span class="token punctuation">[</span>deploy_name<span class="token punctuation">]</span>
</span><span class="code-line">$ kubectl expose deploy <span class="token punctuation">[</span>deploy_name<span class="token punctuation">]</span> <span class="token parameter variable">--port</span><span class="token operator">=</span><span class="token number">80</span> <span class="token parameter variable">--type</span><span class="token operator">=</span>NodePort
</span><span class="code-line">$ kubectl scale deploy <span class="token punctuation">[</span>deploy_name<span class="token punctuation">]</span> <span class="token parameter variable">--replicas</span><span class="token operator">=</span><span class="token number">5</span>
</span><span class="code-line">$ kubectl delete ns
</span><span class="code-line">$ kubectl edit ns <span class="token punctuation">[</span>ns_name<span class="token punctuation">]</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="服务-1"><a aria-hidden="true" tabindex="-1" href="#服务-1"><span class="icon icon-link"></span></a>服务</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl edit svc <span class="token punctuation">[</span>svc_name<span class="token punctuation">]</span>
</span><span class="code-line">$ kubectl delete svc <span class="token punctuation">[</span>svc_name<span class="token punctuation">]</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="守护进程集-1"><a aria-hidden="true" tabindex="-1" href="#守护进程集-1"><span class="icon icon-link"></span></a>守护进程集</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl edit ds <span class="token punctuation">[</span>ds_name<span class="token punctuation">]</span> <span class="token parameter variable">-n</span> kube-system 
</span><span class="code-line">$ kubectl delete ds <span class="token punctuation">[</span>ds_name<span class="token punctuation">]</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="服务账号"><a aria-hidden="true" tabindex="-1" href="#服务账号"><span class="icon icon-link"></span></a>服务账号</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl edit sa <span class="token punctuation">[</span>sa_name<span class="token punctuation">]</span>
</span><span class="code-line">$ kubectl delete sa <span class="token punctuation">[</span>sa_name<span class="token punctuation">]</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="注释"><a aria-hidden="true" tabindex="-1" href="#注释"><span class="icon icon-link"></span></a>注释</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl annotatepo <span class="token punctuation">[</span>pod_name<span class="token punctuation">]</span> <span class="token punctuation">[</span>annotation<span class="token punctuation">]</span>
</span><span class="code-line">$ kubectl annotateno <span class="token punctuation">[</span>node_name<span class="token punctuation">]</span>
</span></code></pre>
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="添加资源"><a aria-hidden="true" tabindex="-1" href="#添加资源"><span class="icon icon-link"></span></a>添加资源</h2><div class="wrap-body">
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="创建容器组"><a aria-hidden="true" tabindex="-1" href="#创建容器组"><span class="icon icon-link"></span></a>创建容器组</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl create <span class="token parameter variable">-f</span> <span class="token punctuation">[</span>name_of_file<span class="token punctuation">]</span> 
</span><span class="code-line">$ kubectl apply <span class="token parameter variable">-f</span> <span class="token punctuation">[</span>name_of_file<span class="token punctuation">]</span>
</span><span class="code-line">$ kubectl run <span class="token punctuation">[</span>pod_name<span class="token punctuation">]</span> <span class="token parameter variable">--image</span><span class="token operator">=</span>nginx <span class="token parameter variable">--restart</span><span class="token operator">=</span>Never
</span><span class="code-line">$ kubectl run <span class="token punctuation">[</span>pod_name<span class="token punctuation">]</span> <span class="token parameter variable">--generator</span><span class="token operator">=</span>run-pod/v1 <span class="token parameter variable">--image</span><span class="token operator">=</span>nginx
</span><span class="code-line">$ kubectl run <span class="token punctuation">[</span>pod_name<span class="token punctuation">]</span> <span class="token parameter variable">--image</span><span class="token operator">=</span>nginx <span class="token parameter variable">--restart</span><span class="token operator">=</span>Never
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="创建服务"><a aria-hidden="true" tabindex="-1" href="#创建服务"><span class="icon icon-link"></span></a>创建服务</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl create svc nodeport <span class="token punctuation">[</span>svc_name<span class="token punctuation">]</span> <span class="token parameter variable">--tcp</span><span class="token operator">=</span><span class="token number">8080</span>:80
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="创建无状态应用"><a aria-hidden="true" tabindex="-1" href="#创建无状态应用"><span class="icon icon-link"></span></a>创建无状态应用</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl create <span class="token parameter variable">-f</span> <span class="token punctuation">[</span>name_of_file<span class="token punctuation">]</span> 
</span><span class="code-line">$ kubectl apply <span class="token parameter variable">-f</span> <span class="token punctuation">[</span>name_of_file<span class="token punctuation">]</span>
</span><span class="code-line">$ kubectl create deploy <span class="token punctuation">[</span>deploy_name<span class="token punctuation">]</span> <span class="token parameter variable">--image</span><span class="token operator">=</span>nginx
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="容器交互"><a aria-hidden="true" tabindex="-1" href="#容器交互"><span class="icon icon-link"></span></a>容器交互</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl run <span class="token punctuation">[</span>pod_name<span class="token punctuation">]</span> <span class="token parameter variable">--image</span><span class="token operator">=</span>busybox <span class="token parameter variable">--rm</span> <span class="token parameter variable">-it</span> <span class="token parameter variable">--restart</span><span class="token operator">=</span>Never -- <span class="token function">sh</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="输出yaml文件"><a aria-hidden="true" tabindex="-1" href="#输出yaml文件"><span class="icon icon-link"></span></a>输出YAML文件</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl create deploy <span class="token punctuation">[</span>deploy_name<span class="token punctuation">]</span> <span class="token parameter variable">--image</span><span class="token operator">=</span>nginx --dry-run <span class="token parameter variable">-o</span> yaml <span class="token operator">></span> deploy.yaml
</span><span class="code-line">$ kubectl get po <span class="token punctuation">[</span>pod_name<span class="token punctuation">]</span> <span class="token parameter variable">-o</span> yaml <span class="token parameter variable">--export</span> <span class="token operator">></span> pod.yaml
</span><span class="code-line">$ kubectl run nginx <span class="token parameter variable">--image</span><span class="token operator">=</span>nginx:alpine --dry-run <span class="token parameter variable">-o</span> <span class="token parameter variable">-yaml</span> <span class="token operator">></span> deploy.yaml
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="获取帮助"><a aria-hidden="true" tabindex="-1" href="#获取帮助"><span class="icon icon-link"></span></a>获取帮助</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl <span class="token parameter variable">-h</span>
</span><span class="code-line">$ kubectl create <span class="token parameter variable">-h</span>
</span><span class="code-line">$ kubectl run <span class="token parameter variable">-h</span>
</span><span class="code-line">$ kubectl explain deploy.spec
</span></code></pre>
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="请求"><a aria-hidden="true" tabindex="-1" href="#请求"><span class="icon icon-link"></span></a>请求</h2><div class="wrap-body">
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="api调用"><a aria-hidden="true" tabindex="-1" href="#api调用"><span class="icon icon-link"></span></a>API调用</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl get <span class="token parameter variable">--raw</span> /apis/metrics.k8s.io/
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="集群信息"><a aria-hidden="true" tabindex="-1" href="#集群信息"><span class="icon icon-link"></span></a>集群信息</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ kubectl config
</span><span class="code-line">$ kubectl cluster-info
</span><span class="code-line">$ kubectl get componentstatus
</span></code></pre>
</div></div></div></div></div><div class="wrap h2body-not-exist"><div class="wrap-header h2wrap"><h2 id="另见"><a aria-hidden="true" tabindex="-1" href="#另见"><span class="icon icon-link"></span></a>另见</h2><div class="wrap-body">
<ul>
<li><a href="https://kubernetes.io/zh-cn/docs/reference/kubectl/">Kubernetes 官方文档 命令行工具 (kubectl)</a> <em>(kubernetes.io)</em></li>
</ul>
</div></div><div class="h2wrap-body"></div></div></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 Kenny Wang.</footer></footer><script src="..\/data.js?v=1.4.1" defer></script><script src="..\/js/fuse.min.js?v=1.4.1" defer></script><script src="..\/js/main.js?v=1.4.1" defer></script><div id="mysearch"><div class="mysearch-box"><div class="mysearch-input"><div><svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 18 18">
  <path fill="currentColor" d="M17.71,16.29 L14.31,12.9 C15.4069846,11.5024547 16.0022094,9.77665502 16,8 C16,3.581722 12.418278,0 8,0 C3.581722,0 0,3.581722 0,8 C0,12.418278 3.581722,16 8,16 C9.77665502,16.0022094 11.5024547,15.4069846 12.9,14.31 L16.29,17.71 C16.4777666,17.8993127 16.7333625,18.0057983 17,18.0057983 C17.2666375,18.0057983 17.5222334,17.8993127 17.71,17.71 C17.8993127,17.5222334 18.0057983,17.2666375 18.0057983,17 C18.0057983,16.7333625 17.8993127,16.4777666 17.71,16.29 Z M2,8 C2,4.6862915 4.6862915,2 8,2 C11.3137085,2 14,4.6862915 14,8 C14,11.3137085 11.3137085,14 8,14 C4.6862915,14 2,11.3137085 2,8 Z"></path>
</svg><input id="mysearch-input" type="search" placeholder="搜索" autocomplete="off"><div class="mysearch-clear"></div></div><button id="mysearch-close" type="button">搜索</button></div><div class="mysearch-result"><div id="mysearch-menu"></div><div id="mysearch-content"></div></div></div></div></body>
</html>
